{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf390
{\fonttbl\f0\fnil\fcharset77 Monaco;}
{\colortbl;\red255\green255\blue255;\red191\green0\blue0;\red0\green0\blue191;\red96\green96\blue96;
}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural

\f0\fs22 \cf2 // triggersAndPitchFollowers.rtf\cf0 \
\cf2 // Macintosh Compiled versions of these are in the folder called synthdefs\cf0 \
\cf2 // A bunch of Synthdefs from the supercollider docs, some modified, some my own...\cf0 \
\cf2 // Some of the below copyright (C) 2003 - 2006 Jonathan Saggau\cf0 \
\cf2 // License: GPL\cf0 \
\cf2 // Others from SC Docs\cf0 \
\cf2 // License: GPL\cf0 \
\cf2 // Still others from SC-users list\cf0 \
\cf2 // License: free\cf0 \
\
\cf2 //___________________________________________________________________________________________\cf0 \
\cf2 // Amplitude Triggers and pitch - followers\cf0 \
\cf2 //___________________________________________________________________________________________\cf0 \
\
(\
\cf2 // trigger one shot on each pulse (PlayBuf help file)\cf0 \
\cf3 SynthDef\cf0 (\cf4 "JASStereoStereoTempoTrigger"\cf0 , \{ \cf3 arg\cf0  out=0,bufnum=0,impulsesPerSec=2.0, amp=1, triggerID;\
	\cf3 var\cf0  trig;\
	trig = \cf3 Impulse\cf0 .kr(impulsesPerSec);\
	\cf3 SendTrig.kr\cf0 (trig, triggerID, amp); \cf2 //send a trigger to the client\cf0 \
	\cf3 Out\cf0 .ar(out,\
		\cf3 PlayBuf.ar(2\cf0 , bufnum, \cf3 BufRateScale\cf0 .kr(bufnum), trig, 0, 0)\
	)\
\}).writeDefFile;\
\
\
\cf2 //From sc-users archive (Modified)\cf0 \
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBuffer"\cf0 ,\
\{\cf3 arg\cf0  out=0, bufnum=0, in=1, thresh = 0.004, amp = 1, durationScaler = 0.2, triggerID = 1;\
	\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool;\
	\
	inAmp = \cf3 Amplitude\cf0 .kr(\cf3 AudioIn\cf0 .ar(in));\
	triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
	gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
	trig = \cf3 Trig1.kr\cf0 (triggerBool, (gatedAmp * amp));\
	\cf3 SendTrig.kr\cf0 (trig, triggerID, (gatedAmp * amp)); \cf2 //send a trigger to the client\cf0 \
	\cf3 Out\cf0 .ar(out,\
		(\cf3 PlayBuf.ar(2\cf0 , bufnum, \cf3 BufRateScale\cf0 .kr(bufnum), trig, 0, 0) \
		* (gatedAmp * amp)\
		)\
	)\
\}).writeDefFile;\
\
\
\cf2 // From: Samuel Pluta <spluta@gmail.com> (badass!)\cf0 \
\cf2 // With modifications by Jonathan Saggau\
\
\cf0 \
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap32"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05,  bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 32; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds); \cf2 // why div, Sam?\cf0 \
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = \cf3 PulseCount\cf0 .kr(trig);\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf2 //As above, only no moving through the buffer.\cf0 \
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap32Static"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition = 200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 32; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds);\
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = 1;\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap24"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 24; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds); \cf2 // why div, Sam?\cf0 \
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = \cf3 PulseCount\cf0 .kr(trig);\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf2 //As above, only no moving through the buffer.\cf0 \
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap24Static"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 24; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds);\
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = 1;\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\cf2 // From: Samuel Pluta <spluta@gmail.com> (badass!)\cf0 \
\cf2 // With modifications by Jonathan Saggau\cf0 \
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap16"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 16; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds); \cf2 // why div, Sam?\cf0 \
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = \cf3 PulseCount\cf0 .kr(trig);\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf2 //As above, only no moving through the buffer.\cf0 \
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap16Static"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 16; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds);\
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = 1;\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap12"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 12; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds); \cf2 // why div, Sam?\cf0 \
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = \cf3 PulseCount\cf0 .kr(trig);\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf2 //As above, only no moving through the buffer.\cf0 \
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap12Static"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 12; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds);\
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = 1;\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap6"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 6; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds); \cf2 // why div, Sam?\cf0 \
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = \cf3 PulseCount\cf0 .kr(trig);\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf2 //As above, only no moving through the buffer.\cf0 \
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBOlap6Static"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 6; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds);\
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = 1;\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBNoOlap"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 1; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds); \cf2 // why div, Sam?\cf0 \
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = \cf3 PulseCount\cf0 .kr(trig);\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
\
\
\cf2 //As above, only no moving through the buffer.\cf0 \
\
\cf3 SynthDef\cf0 (\cf4 "JASStereoTriggerBNoOlapStatic"\cf0 ,\
\{\cf3 arg\cf0  outBus=0, bufnum=0, in=1, thresh = 0.004, amp = 1, duration =0.2, triggerID = 1,  envCurve = -7, attackDuration = 0.05, bufferPosition =200;\
\cf3 var\cf0  trig, inAmp, gatedAmp, triggerBool, outamp, bufferFrames,bufRateScale, bufPointer, env, envGenList, outList, trigList, maxNumOverlapSounds;\
\
maxNumOverlapSounds = 1; \cf2 //set this as you like it.  \cf0 \
\
bufferFrames = \cf3 BufFrames\cf0 .kr(bufnum);\
bufRateScale = \cf3 BufRateScale\cf0 .kr(bufnum);\
inAmp = \cf3 Amplitude\cf0 .kr (\cf3 AudioIn\cf0 .ar(in));\
triggerBool = (\cf3 AudioIn\cf0 .ar(in) >= thresh);\
gatedAmp = \cf3 Latch\cf0 .kr(inAmp, triggerBool);\
outamp = (gatedAmp * amp);\
\
trig = \cf3 Trig1.kr\cf0 (triggerBool, duration / maxNumOverlapSounds);\
\cf3 SendTrig.kr (trig, triggerID, outamp);\cf0  \cf2 //send a trigger to the client\cf0 \
\
bufPointer = 1;\
\
env = \cf3 Env\cf0 .perc(attackDuration, (duration - attackDuration), outamp, envCurve);\
             \cf2 //  *perc(attackTime,      releaseTime,                         peakLevel, curve)\cf0 \
trigList = \cf3 List\cf0 .series(maxNumOverlapSounds); \cf2 //List.new doesn't work here? hmmm I dunno why\cf0 \
envGenList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
outList = \cf3 List\cf0 .series(maxNumOverlapSounds);\
\
\
maxNumOverlapSounds.do(\{ \cf3 arg\cf0  i;\
	trigList.put(i, \cf3 PulseDivider\cf0 .kr(trig, maxNumOverlapSounds, i));\
	envGenList.put(i, \cf3 EnvGen\cf0 .kr(env, trigList.at(i)));\
	outList.put(i, \cf3 PlayBuf.ar(2\cf0 , bufnum, bufRateScale, trigList.at(i),(bufPointer*bufferPosition)%bufferFrames)*envGenList.at(i));\
\});\
\cf3 Out\cf0 .ar(outBus, sum(outList));\
\}).writeDefFile;\
)}